﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="APIEdit.aspx.cs" Inherits="mapex.api.APIEdit" %>

<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>API编辑-<%=Request["control"] %></title>
    <script src="../ueditor/utf8-net/third-party/jquery-1.10.2.min.js"></script>
</head>
<body>
    <!-- 加载编辑器的容器 -->
    <script id="container" name="content" type="text/plain" style="height: 500px;"></script>
    <p>
        <button id="btnSave">保存</button>
    </p>
    <!-- 配置文件 -->
    <script type="text/javascript" src="../ueditor/utf8-net/ueditor.config.js"></script>
    <!-- 编辑器源码文件 -->
    <script type="text/javascript" src="../ueditor/low-ie.js"></script>
    <script type="text/javascript" src="../ueditor/utf8-net/ueditor.all.js"></script>
    <script type="text/javascript" charset="utf-8" src="../ueditor/utf8-net/lang/zh-cn/zh-cn.js"></script>
    <!-- 实例化编辑器 -->
    <script type="text/javascript">
        var ue = UE.getEditor('container', {
            maximumWords: 1000000
        });

        $(function () {

            //初始化
            $.post("APIHandler.ashx?method=GetAPIContent", {
                Control: '<%=Request["control"] %>'
            }, function (result) {
                ue.setContent(result);
            });

            //保存
            $("#btnSave").click(function () {
                var html = ue.getContent();
                $.post("APIHandler.ashx?method=SaveAPIContent", {
                    Content: html,
                    Control: '<%=Request["control"] %>'
                }, function (result) {
                    alert(result);
                });
            });
        });
    </script>
</body>
</html>
